import sysConfig from "@/config"
import { createI18n } from 'vue3-i18n'
import { useLocalStorage } from "@vueuse/core";
import antenUS from 'ant-design-vue/es/locale/en_US';
import antzhCN from 'ant-design-vue/es/locale/zh_CN';

import zh_cn from './lang/zh-cn.js'
import en from './lang/en.js'

const lang = useLocalStorage('LANG', sysConfig.LANG)

const messages = {
	'zh-cn': {
		el: antzhCN,
		...zh_cn
	},
	'en': {
		el: antenUS,
		...en
	}
}

const i18n = createI18n({
	locale: lang.value,
	fallbackLocale: 'zh-cn',
	globalInjection: true,
	messages,
})

export default i18n;
